<?php


namespace app\admin\validate;


use think\Validate;

class Goods extends Validate
{
    protected $rule = [
        "id" => "require|number|gt:0",
        "title|标题"=> "require|max:100",
        "title_cut|精简标题"=> "require|max:20",
        "category_id|分类ID"=> "require|number|gt:0",
        "category_path_id|分类ID path"=> "require|max:20",
        "promotion_title|促销语"=> "max:220",
        "goods_unit|单位"=> "require|max:20",
        "keywords|关键词"=> "max:100",
        "stock|库存"=> "number",
        "price|价格"=> "number",
        "cost_price|原价"=> "number",
        "sku_id|sku_Id"=> "number",
        "is_show_stock|是否显示库存"=> "require|in:0,1",
        "production_time|生产日期"=> "date",
        "goods_specs_type|商品规格"=> "require|in:1,2",
        "is_index_recommend|推荐" => 'in:0,1',
    ];

    protected $scene = [
        "add" => ['title', 'title_cut', 'category', 'category_path_id', 'promotion_title', 'goods_unit', 'keywords', 'stock', 'price', 'stock', 'price', 'cost_price', 'sku_id', 'is_show_stock', 'production_time', 'goods_specs_type', 'is_index_recommend'],
        "edit" => ['id', 'title', 'title_cut', 'category', 'category_path_id', 'promotion_title', 'goods_unit', 'keywords', 'stock', 'price', 'stock', 'price', 'cost_price', 'sku_id', 'is_show_stock', 'production_time', 'goods_specs_type', 'is_index_recommend'],
    ];
}